﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MongoDB.Bson;
using WanPiJie.Products;
using System.Security.Cryptography;

namespace WanPiJie
{
	public class WpjUtility
	{
		/// <summary>
		/// 32位MD5加密
		/// </summary>
		/// <param name="input">明文</param>
		/// <returns>密文</returns>
		public static string GetMd5Hash(string input)
		{
			MD5 md5Hasher = MD5.Create();
			byte[] data = md5Hasher.ComputeHash(Encoding.Default.GetBytes(input));
			StringBuilder sBuilder = new StringBuilder();
			for (int i = 0; i < data.Length; i++)
			{
				sBuilder.Append(data[i].ToString("x2"));
			}
			return sBuilder.ToString();
		}
	}
}
